﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using MySql.Data.MySqlClient;
using MySql.Data.Types;

namespace Login
{
    public partial class LoginScreen : Form
    {


        public LoginScreen()
        {
            InitializeComponent();
        }


        private void btnLogin_Click(object sender, EventArgs e)
        {
            SqlConnection grabConnection = new SqlConnection("server=localhost;" + "database=grab;" + "user id=root;" + "password=;");

            SqlParameter Username = new SqlParameter("@Param1", SqlDbType.VarChar, 20);
            Username.Value = txtUsername.Text;

            SqlParameter Password = new SqlParameter("@Param2", SqlDbType.VarChar, 20);
            Password.Value = txtPassword.Text;

            try
            {
                grabConnection.Open();
                SqlCommand login = new SqlCommand("SELECT * FROM confirmed_users", grabConnection);
                MessageBox.Show("Logged in");
            }
            catch (Exception u)
            {
                MessageBox.Show("Error, wrong username or password");
            }

            grabConnection.Close();

        }  

    }
}

